<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Microsoft.PlayerFramework.CaptionSettings"
    xmlns:ValueConverters="using:Microsoft.PlayerFramework.CaptionSettings.ValueConverters"
    xmlns:Controls="using:Microsoft.PlayerFramework.CaptionSettings.Controls">
    <ValueConverters:FontFamilyConverter x:Key="FontFamilyConverter"/>
    <ValueConverters:FontSizeConverter x:Key="FontSizeConverter" FontSize="30" />
    <ValueConverters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
    <ValueConverters:ColorTypeConverter x:Key="ColorTypeConverter"/>
    <ValueConverters:ResourceConverter x:Key="ResourceConverter"/>
    <ValueConverters:CapitalsConverter x:Key="CaptialsConverter"/>
    <!-- This style adds a bottom margin of 22px and hides the pressed style (fixing a bug) -->
    <Style x:Key="ComboBoxStyle" TargetType="ComboBox">
        <Setter Property="Padding" Value="8,0"/>
        <Setter Property="Margin" Value="0,0,0,22"/>
        <Setter Property="MinWidth" Value="{ThemeResource ComboBoxThemeMinWidth}"/>
        <Setter Property="Foreground" Value="{ThemeResource ComboBoxForegroundThemeBrush}"/>
        <Setter Property="Background" Value="{ThemeResource ComboBoxBackgroundThemeBrush}"/>
        <Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}"/>
        <Setter Property="BorderThickness" Value="{ThemeResource ComboBoxBorderThemeThickness}"/>
        <Setter Property="TabNavigation" Value="Once"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/>
        <Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto"/>
        <Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True"/>
        <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
        <Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <CarouselPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="32"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPointerOverBackgroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPointerOverBorderThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="Highlight">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxSelectedPointerOverBackgroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPressedBackgroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPressedBorderThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPressedForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PressedBackground"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="DropDownGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxArrowPressedForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxDisabledBackgroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxDisabledBorderThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxDisabledForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="DropDownGlyph">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxArrowDisabledForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightBackground"/>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Highlight"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxFocusedForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="FocusedPressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPressedForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="Highlight">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ComboBoxPressedHighlightThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="PointerFocused"/>
                                <VisualState x:Name="FocusedDropDown">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PopupBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="DropDownStates">
                                <VisualState x:Name="Opened">
                                    <Storyboard>
                                        <SplitOpenThemeAnimation ClosedTargetName="ContentPresenter" ContentTranslationOffset="0" ContentTargetName="ScrollViewer" ClosedLength="{Binding TemplateSettings.DropDownClosedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}" OffsetFromCenter="{Binding TemplateSettings.DropDownOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}" OpenedTargetName="PopupBorder" OpenedLength="{Binding TemplateSettings.DropDownOpenedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Closed">
                                    <Storyboard>
                                        <SplitCloseThemeAnimation ClosedTargetName="ContentPresenter" ContentTranslationOffset="40" ContentTranslationDirection="{Binding TemplateSettings.SelectedItemDirection, RelativeSource={RelativeSource Mode=TemplatedParent}}" ContentTargetName="ScrollViewer" ClosedLength="{Binding TemplateSettings.DropDownClosedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}" OffsetFromCenter="{Binding TemplateSettings.DropDownOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}" OpenedTargetName="PopupBorder" OpenedLength="{Binding TemplateSettings.DropDownOpenedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="HeaderContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{ThemeResource ComboBoxHeaderForegroundThemeBrush}" FontWeight="{ThemeResource ComboBoxHeaderThemeFontWeight}" FlowDirection="{TemplateBinding FlowDirection}" Margin="{ThemeResource ComboBoxHeaderThemeMargin}" Visibility="Collapsed"/>
                        <Border x:Name="Background" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" Grid.Row="1"/>
                        <Rectangle x:Name="PressedBackground" Fill="{ThemeResource ComboBoxPressedHighlightThemeBrush}" Margin="{TemplateBinding BorderThickness}" Opacity="0" Grid.Row="1" Visibility="Collapsed"/>
                        <Border x:Name="HighlightBackground" BorderBrush="{ThemeResource ComboBoxFocusedBorderThemeBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{ThemeResource ComboBoxFocusedBackgroundThemeBrush}" Grid.ColumnSpan="2" Opacity="0" Grid.Row="1"/>
                        <Rectangle x:Name="Highlight" Fill="{ThemeResource ComboBoxSelectedBackgroundThemeBrush}" Margin="{TemplateBinding BorderThickness}" Opacity="0" Grid.Row="1"/>
                        <ContentPresenter x:Name="ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <TextBlock x:Name="PlaceholderTextBlock" Foreground="{ThemeResource ComboBoxPlaceholderTextForegroundThemeBrush}" FontWeight="{ThemeResource ComboBoxPlaceholderTextThemeFontWeight}" Text="{TemplateBinding PlaceholderText}"/>
                        </ContentPresenter>
                        <TextBlock x:Name="DropDownGlyph" AutomationProperties.AccessibilityView="Raw" Grid.Column="1" Foreground="{ThemeResource ComboBoxArrowForegroundThemeBrush}" FontWeight="Bold" FontSize="{ThemeResource ComboBoxArrowThemeFontSize}" FontFamily="{ThemeResource SymbolThemeFontFamily}" HorizontalAlignment="Right" IsHitTestVisible="False" Margin="0,0,6,4" Grid.Row="1" Text="&#xE011;" VerticalAlignment="Center"/>
                        <Popup x:Name="Popup">
                            <Border x:Name="PopupBorder" BorderBrush="{ThemeResource ComboBoxPopupBorderThemeBrush}" BorderThickness="{ThemeResource ComboBoxPopupBorderThemeThickness}" Background="{ThemeResource ComboBoxPopupBackgroundThemeBrush}" HorizontalAlignment="Stretch">
                                <ScrollViewer x:Name="ScrollViewer" AutomationProperties.AccessibilityView="Raw" BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}" Foreground="{ThemeResource ComboBoxPopupForegroundThemeBrush}" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" MinWidth="{ThemeResource ComboBoxPopupThemeMinWidth}" VerticalSnapPointsType="OptionalSingle" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" VerticalSnapPointsAlignment="Near" ZoomMode="Disabled">
                                    <ItemsPresenter/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="ColorButtonTemplate" TargetType="Button">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="PointerOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
        							Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonPointerOverBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
        							Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonPointerOverForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
        							Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonPressedBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
        							Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonPressedForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
        							Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
        							Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledBorderThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
        							Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ContentPresenter">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="FocusVisualWhite"
        							Storyboard.TargetProperty="Opacity"
        							To="1"
        							Duration="0" />
                            <DoubleAnimation Storyboard.TargetName="FocusVisualBlack"
        							Storyboard.TargetProperty="Opacity"
        							To="1"
        							Duration="0" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unfocused" />
                    <VisualState x:Name="PointerFocused" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Border"
        			Background="{TemplateBinding Background}"
        			BorderBrush="{TemplateBinding BorderBrush}"
        			BorderThickness="{TemplateBinding BorderThickness}"
        			Margin="3">
                <ContentPresenter x:Name="ContentPresenter"
        				Content="{TemplateBinding Content}"
        				ContentTransitions="{TemplateBinding ContentTransitions}"
        				ContentTemplate="{TemplateBinding ContentTemplate}"
        				Margin="{TemplateBinding Padding}"
        				HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
        				VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
        				AutomationProperties.AccessibilityView="Raw"/>
            </Border>
            <Rectangle x:Name="FocusVisualWhite"
        			IsHitTestVisible="False"
        			Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}"
        			StrokeEndLineCap="Square"
        			StrokeDashArray="1,1"
        			Opacity="0"
        			StrokeDashOffset="1.5" />
            <Rectangle x:Name="FocusVisualBlack"
        			IsHitTestVisible="False"
        			Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}"
        			StrokeEndLineCap="Square"
        			StrokeDashArray="1,1"
        			Opacity="0"
        			StrokeDashOffset="0.5" />
        </Grid>
    </ControlTemplate>
    <Style x:Key="ColorButtonStyle" TargetType="Button">
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TranslateTransform Y="3" X="4"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Margin" Value="10,0,0,0"/>
        <Setter Property="Width" Value="38"/>
        <Setter Property="Height" Value="38"/>
        <Setter Property="Grid.Column" Value="1"/>
        <Setter Property="Content" Value="{x:Null}"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Bottom"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template" Value="{StaticResource ColorButtonTemplate}"/>
    </Style>
    <Style x:Key="BaseTextBlockStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
        <Setter Property="SelectionHighlightColor" Value="{ThemeResource TextSelectionHighlightColorThemeBrush}"/>
        <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Typography.StylisticSet20" Value="True"/>
        <Setter Property="Typography.DiscretionaryLigatures" Value="True"/>
        <Setter Property="Typography.CaseSensitiveForms" Value="True"/>
        <Setter Property="LineHeight" Value="20"/>
        <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
        <Setter Property="TextLineBounds" Value="TrimToBaseline"/>
        <Setter Property="OpticalMarginAlignment" Value="TrimSideBearings"/>
    </Style>
    <Style x:Key="GroupTitleTextStyle" BasedOn="{StaticResource BaseTextBlockStyle}" TargetType="TextBlock">
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Margin" Value="0,0,0,5"/>
    </Style>
    <Style x:Key="ColorGridStyle" TargetType="Grid">
        <Setter Property="Margin" Value="0,0,0,22"/>
    </Style>
    <DataTemplate x:Key="ResourceTemplate">
        <TextBlock Text="{Binding Converter={StaticResource ResourceConverter}, Mode=OneWay}"/>
    </DataTemplate>
    <DataTemplate x:Key="ColorTypeTemplate">
        <TextBlock Text="{Binding Converter={StaticResource ColorTypeConverter}}"/>
    </DataTemplate>
    <Style x:Key="ColorSwatchBorderStyle" TargetType="Border">
        <Setter Property="Margin" Value="0,0,1,0"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="DarkGray"/>
    </Style>

    <!-- Caption Settings Control -->
    <Style TargetType="local:CaptionSettingsControl">
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CaptionSettingsControl">
                    <Grid Background="{TemplateBinding Background}">
                        <StackPanel Margin="{TemplateBinding Margin}">
                            <ToggleSwitch x:Name="EnableCaptionSettings" x:Uid="EnableCaptionSettings" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="-6,0,0,0" IsOn="{Binding IsEnabled, Mode=TwoWay}">
                                <ToggleSwitch.Header>
                                    <TextBlock TextWrapping="Wrap" Text="Ignore default caption fonts and colors" x:Uid="EnableCaptionSettingsHeader"/>
                                </ToggleSwitch.Header>
                            </ToggleSwitch>
                            <StackPanel x:Name="PreviewPanel" Orientation="Vertical">
                                <TextBlock x:Name="PreviewLabel" x:Uid="Preview" Text="Preview" Style="{StaticResource GroupTitleTextStyle}" Margin="0,0,0,10"/>
                                <Controls:PreviewControl x:Name="Preview" 
                        AutomationProperties.Name="Caption Preview"
                                             AutomationProperties.LabeledBy="{Binding ElementName=PreviewLabel}"
					    Foreground="{Binding Settings.FontColor, Converter={StaticResource ColorToBrushConverter}}" 
					    CaptionBackground="{Binding Settings.BackgroundColor, Converter={StaticResource ColorToBrushConverter}}" 
					    WindowColor="{Binding Settings.WindowColor, Converter={StaticResource ColorToBrushConverter}}" 
					    FontSize="{Binding Settings.FontSize, Converter={StaticResource FontSizeConverter}}" OutlineWidth="1" 
					    CaptionFontStyle="DropShadow" 
					    FontFamily="{Binding Settings.FontFamily, Converter={StaticResource FontFamilyConverter}}"
					    Typography.Capitals="{Binding Settings.FontFamily, Converter={StaticResource CaptialsConverter}}" 
                        PreviewText="Aaa Bbb Ccc Ddd"
                        MaxHeight="100"
                        Margin="0,0,0,10"/>
                            </StackPanel>
                            <TextBlock x:Name="Font" Text="Font" x:Uid="Font" Style="{StaticResource GroupTitleTextStyle}"/>
                            <Controls:CaptionComboBox x:Name="Family" x:Uid="Family"
				    Header="Family"
				    ItemsSource="{Binding FontFamilies}"
				    SelectedItem="{Binding Settings.FontFamily, Mode=TwoWay}" Style="{StaticResource ComboBoxStyle}" 
				    IsEnabled="{Binding IsOn, ElementName=EnableCaptionSettings}" ItemTemplate="{StaticResource ResourceTemplate}"/>
                            <Controls:CaptionComboBox x:Name="CaptionFontSize" x:Uid="Size" ItemsSource="{Binding FontSizes}" Header="Size (%)" 
				    IsEnabled="{Binding IsOn, ElementName=EnableCaptionSettings}"
				    Style="{StaticResource ComboBoxStyle}" SelectedItem="{Binding Settings.FontSize, Converter={StaticResource FontSizeConverter}, Mode=TwoWay, TargetNullValue=Default}"/>
                            <Controls:CaptionComboBox x:Name="CaptionFontStyle" x:Uid="FontStyle" ItemsSource="{Binding FontStyles}" Header="Font Style" 
				    IsEnabled="{Binding IsOn, ElementName=EnableCaptionSettings}"
				    Style="{StaticResource ComboBoxStyle}" 
                    SelectedItem="{Binding Settings.FontStyle}"
				    ItemTemplate="{StaticResource ResourceTemplate}" 
                            />
                            <TextBlock x:Name="Color" Text="Color" x:Uid="Character" Style="{StaticResource GroupTitleTextStyle}"/>
                            <Grid x:Name="FontColor" Style="{StaticResource ColorGridStyle}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Controls:CaptionComboBox x:Name="FontColorType" x:Uid="FontColor" Header="Font" 
					    IsEnabled="{Binding IsOn, ElementName=EnableCaptionSettings}"
                        ItemTemplate="{StaticResource ColorTypeTemplate}"
                        ItemsSource="{Binding FontColorTypes}"
					    SelectedItem="{Binding FontColorType, Mode=TwoWay}"/>
                                <Button x:Name="FontColorButton" Style="{StaticResource ColorButtonStyle}" 
					    IsEnabled="{Binding IsFontColorEnabled, Mode=OneWay}"
					    Template="{StaticResource ColorButtonTemplate}" >
                                    <Button.Flyout>
                                        <Flyout>
                                            <Controls:ColorPickerControl x:Name="FontColorPicker"   
                                                             AutomationProperties.Name="Font Color Picker"
                                                             ColorType="{Binding FontColorType}"
                                                             SelectedColor="{Binding Settings.FontColor, Mode=TwoWay}"/>
                                        </Flyout>
                                    </Button.Flyout>
                                    <Border Style="{StaticResource ColorSwatchBorderStyle}">
                                        <Grid Background="{Binding Settings.FontColor, Converter={StaticResource ColorToBrushConverter}}"/>
                                    </Border>
                                </Button>
                            </Grid>
                            <Grid x:Name="BackgroundColor" Style="{StaticResource ColorGridStyle}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Controls:CaptionComboBox x:Name="BackgroundColorType" x:Uid="BackgroundColor" Header="Background"
					    IsEnabled="{Binding IsOn, ElementName=EnableCaptionSettings}" 
                                          ItemsSource="{Binding BackgroundColorTypes}"
					    SelectedItem="{Binding BackgroundColorType, Mode=TwoWay}"                          
                              ItemTemplate="{StaticResource ColorTypeTemplate}"/>
                                <Button x:Name="BackgroundColorButton" Style="{StaticResource ColorButtonStyle}" 
					    IsEnabled="{Binding IsBackgroundColorEnabled, Mode=OneWay}">
                                    <Button.Flyout>
                                        <Flyout>
                                            <Controls:ColorPickerControl x:Name="BackgroundColorPicker"  
                                                             ColorType="{Binding BackgroundColorType}"
                                                             AutomationProperties.Name="Background Color Picker"
                                                             SelectedColor="{Binding Settings.BackgroundColor, Mode=TwoWay}"/>
                                        </Flyout>
                                    </Button.Flyout>
                                    <Border Style="{StaticResource ColorSwatchBorderStyle}">

                                        <Grid Background="{Binding Settings.BackgroundColor, Converter={StaticResource ColorToBrushConverter}}"/>
                                    </Border>
                                </Button>
                            </Grid>
                            <Grid x:Name="WindowColor" Style="{StaticResource ColorGridStyle}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Controls:CaptionComboBox x:Name="WindowColorType" x:Uid="WindowColor" Header="Window"  
					    IsEnabled="{Binding IsOn, ElementName=EnableCaptionSettings}"
                                          ItemsSource="{Binding WindowColorTypes}"
					    SelectedItem="{Binding WindowColorType, Mode=TwoWay}"
                        ItemTemplate="{StaticResource ColorTypeTemplate}"/>

                                <Button x:Name="WindowColorButton" Style="{StaticResource ColorButtonStyle}" 
					    IsEnabled="{Binding IsWindowColorEnabled, Mode=OneWay}">
                                    <Button.Flyout>
                                        <Flyout>
                                            <Controls:ColorPickerControl x:Name="WindowColorPicker" 
                                                             AutomationProperties.Name="Window Color Picker"
                                                             SelectedColor="{Binding Settings.WindowColor, Mode=TwoWay}"
                                                             ColorType="{Binding WindowColorType}"/>
                                        </Flyout>
                                    </Button.Flyout>
                                    <Border Style="{StaticResource ColorSwatchBorderStyle}">

                                        <Grid Background="{Binding Settings.WindowColor, Converter={StaticResource ColorToBrushConverter}}"/>
                                    </Border>
                                </Button>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- Preview Control -->
    <Style TargetType="Controls:PreviewControl">
        <Setter Property="Padding" Value="10"/>
        <Setter Property="BorderThickness" Value="10"/>
        <Setter Property="Background" Value="Gray"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:PreviewControl">
                    <Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FontStyleStates">
                                <VisualState x:Name="Default"/>
                                <VisualState x:Name="None">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Edges">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="RaisedEdge">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="TopLeft">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Top">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="TopRight">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Left">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BottomLeft">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="DepressedEdge">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="TopRight">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Right">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BottomLeft">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Bottom">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BottomRight">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Outline">
                                </VisualState>
                                <VisualState x:Name="DropShadow">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="TopLeft">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Top">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="TopRight">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Left">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BottomLeft">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Edges"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.Resources>
                            <Style x:Key="PreviewTextStyle" TargetType="TextBlock" >
                                <Setter Property="HorizontalAlignment" Value="Stretch"/>
                                <Setter Property="Foreground" Value="White"/>
                                <Setter Property="VerticalAlignment" Value="Center"/>
                                <Setter Property="TextAlignment" Value="Center"/>
                                <Setter Property="Text" Value="Aaa Bbb Ccc"/>
                            </Style>
                        </Grid.Resources>
                        <Border x:Name="PreviewWindow" Margin="{TemplateBinding BorderThickness}" Background="{TemplateBinding WindowColor}">
                            <Grid x:Name="PreviewBackground" Background="{TemplateBinding CaptionBackground}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                <Grid.RenderTransform>
                                    <CompositeTransform/>
                                </Grid.RenderTransform>
                                <Grid x:Name="Edges" CacheMode="BitmapCache">
                                    <TextBlock x:Name="TopLeft" Text="{TemplateBinding PreviewText}" Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform TranslateX="-1" 
                                                                TranslateY="-1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="Top" Text="{TemplateBinding PreviewText}" Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform TranslateY="-1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="TopRight" Text="{TemplateBinding PreviewText}" Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform TranslateX="1" 
                                                                TranslateY="-1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="Left" Text="{TemplateBinding PreviewText}" 
            			Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform 
            					TranslateX="-1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="Right" 
            			Text="{TemplateBinding PreviewText}" 
            			Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform TranslateX="1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="BottomLeft" 
            			Text="{TemplateBinding PreviewText}" 
            			Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform 
            					TranslateX="-1" 
            					TranslateY="1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="Bottom" 
            			Text="{TemplateBinding PreviewText}" 
            			Style="{StaticResource PreviewTextStyle}"  
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" 
            			Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform TranslateY="1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                    <TextBlock x:Name="BottomRight" 
            			Text="{TemplateBinding PreviewText}" Style="{StaticResource PreviewTextStyle}" 
            			FontSize="{TemplateBinding FontSize}" RenderTransformOrigin="0.5,0.5" 
            			Foreground="Black" >
                                        <TextBlock.RenderTransform>
                                            <CompositeTransform TranslateX="1" 
            					TranslateY="1"/>
                                        </TextBlock.RenderTransform>
                                    </TextBlock>
                                </Grid>
                                <TextBlock Text="{TemplateBinding PreviewText}" x:Name="Center" Style="{StaticResource PreviewTextStyle}" 
                           Foreground="{TemplateBinding Foreground}" 
                           FontSize="{TemplateBinding FontSize}" />
                            </Grid>
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- Color Picker Control -->
    <Style TargetType="Controls:ColorPickerControl">
        <Setter Property="Width" Value="160"/>
        <Setter Property="Height" Value="80"/>
        <Setter Property="Foreground" Value="Gray"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:ColorPickerControl">
                    <Grid Background="{TemplateBinding Background}" >
                        <Grid.Resources>
                            <Style x:Key="ColorSwatch" TargetType="Rectangle">
                                <Setter Property="Margin" Value="5"/>
                            </Style>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Rectangle x:Name="White" Fill="White" AutomationProperties.Name="White" Style="{StaticResource ColorSwatch}"
                                   Stroke="{TemplateBinding Foreground}"/>
                        <Rectangle x:Name="Black" Fill="Black" AutomationProperties.Name="Black" Stroke="{TemplateBinding Foreground}" 
                                   Style="{StaticResource ColorSwatch}" Grid.Column="1"/>
                        <Rectangle x:Name="Red" Fill="Red" AutomationProperties.Name="Red" Stroke="{TemplateBinding Foreground}" 
                                   Style="{StaticResource ColorSwatch}"  Grid.Column="2"/>
                        <Rectangle x:Name="Green" Fill="Green" AutomationProperties.Name="Green" Stroke="{TemplateBinding Foreground}" 
                                   Style="{StaticResource ColorSwatch}"  Grid.Column="3"/>
                        <Rectangle x:Name="Blue" Fill="Blue" AutomationProperties.Name="Blue" Stroke="{TemplateBinding Foreground}" 
                                   Style="{StaticResource ColorSwatch}"  Grid.Row="1"/>
                        <Rectangle x:Name="Yellow" Fill="Yellow" AutomationProperties.Name="Yellow" Stroke="{TemplateBinding Foreground}" 
                                   Style="{StaticResource ColorSwatch}"  Grid.Row="1" Grid.Column="1"/>
                        <Rectangle x:Name="Magenta" Fill="Magenta" AutomationProperties.Name="Magenta" 
                                   Stroke="{TemplateBinding Foreground}" Style="{StaticResource ColorSwatch}"  Grid.Row="1" Grid.Column="2" />
                        <Rectangle x:Name="Cyan" Fill="Cyan" AutomationProperties.Name="Cyan" Stroke="{TemplateBinding Foreground}" 
                                   Style="{StaticResource ColorSwatch}" Grid.Row="1" Grid.Column="3"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
